package com.twm.boot;

import com.twm.client.RPCConsumer;
import com.twm.entity.RpcRequest;
import com.twm.service.IUserService;

public class ConsumerBoot {

    //参数定义
    private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {
        //创建代理对象
//        IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class, PROVIDER_NAME);
        IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class);
        //循环给服务 器写数据
        while (true){
            RpcRequest rpcRequest = new RpcRequest();
            rpcRequest.setClassName("com.twm.entity.RpcRequest");
            rpcRequest.setMethodName("getRpcRequest");
            rpcRequest.setRequestId("userServiceImpl");
            rpcRequest.setParameters(new Object[]{"Hello Netty------"});
            rpcRequest.setParameterTypes(new Class[]{String.class});
            String result = service.getRpcRequest(rpcRequest);
            System.out.println(result);
            Thread.sleep(2000);
        }
    }
}
